﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.SC.CDTY
{
    /// <summary>
    /// HuLiJiLuCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class HuLiJiLuCtrl : CustomCommonTableCtrl
    {
        public HuLiJiLuCtrl()
        {
            InitializeComponent();
            rq2.GotFocus += rq_GotFocus; rq3.GotFocus += rq_GotFocus; rq4.GotFocus += rq_GotFocus;
            rq5.GotFocus += rq_GotFocus; rq9.GotFocus += rq_GotFocus; rq7.GotFocus += rq_GotFocus;
            rq8.GotFocus += rq_GotFocus; rq10.GotFocus += rq_GotFocus; rq11.GotFocus += rq_GotFocus;
            rq12.GotFocus += rq_GotFocus; rq13.GotFocus += rq_GotFocus; rq14.GotFocus += rq_GotFocus;
            rq17.GotFocus += rq_GotFocus; rq18.GotFocus += rq_GotFocus;
            sj1.GotFocus += sj_GotFocus; sj2.GotFocus += sj_GotFocus; sj3.GotFocus += sj_GotFocus;
            sj4.GotFocus += sj_GotFocus; sj5.GotFocus += sj_GotFocus; sj6.GotFocus += sj_GotFocus;
            sj7.GotFocus += sj_GotFocus; sj8.GotFocus += sj_GotFocus; sj9.GotFocus += sj_GotFocus;
            sj10.GotFocus += sj_GotFocus; sj11.GotFocus += sj_GotFocus; sj12.GotFocus += sj_GotFocus;
            sj13.GotFocus += sj_GotFocus; sj14.GotFocus += sj_GotFocus;
        }
        private void rq_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cutomText = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                cutomText.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMD_CN);//xxxx年xx月xx日
            }
        }
        private void sj_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cutomText = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                cutomText.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_HM);//xxxx年xx月xx日
            }
        }
    }
}
